home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / gpp-1_42.lha / g++-1.42.0 / cplus-tree.h < prev    next >
C/C++ Source or Header  |  1991-10-19  |  64KB  |  1,577 lines

  1. /* Definitions for C++ parsing and type checking.
  2.    Copyright (C) 1987 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@mcc.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY.  No author or distributor
  9. accepts responsibility to anyone for the consequences of using it
  10. or for whether it serves any particular purpose or works at all,
  11. unless he says so in writing.  Refer to the GNU CC General Public
  12. License for full details.
  13.  
  14. Everyone is granted permission to copy, modify and redistribute
  15. GNU CC, but only under the conditions described in the
  16. GNU CC General Public License.   A copy of this license is
  17. supposed to have been given to you along with GNU CC so you
  18. can know your rights and responsibilities.  It should be in a
  19. file named COPYING.  Among other things, the copyright notice
  20. and this notice must be preserved on all copies.  */
  21.  
  22. /* Borrow everything that is C from c-tree.h,
  23.    but do so by copy, not by inclusion, since c-tree.h defines
  24.    lang_identifier.  */
  25.  
  26. /* Definitions for C parsing and type checking.
  27.    Copyright (C) 1987 Free Software Foundation, Inc.
  28.  
  29. This file is part of GNU CC.
  30.  
  31. GNU CC is free software; you can redistribute it and/or modify
  32. it under the terms of the GNU General Public License as published by
  33. the Free Software Foundation; either version 1, or (at your option)
  34. any later version.
  35.  
  36. GNU CC is distributed in the hope that it will be useful,
  37. but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. GNU General Public License for more details.
  40.  
  41. You should have received a copy of the GNU General Public License
  42. along with GNU CC; see the file COPYING.  If not, write to
  43. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  44.  
  45. /* Language-dependent contents of an identifier.  */
  46.  
  47. struct lang_identifier
  48. {
  49.   struct tree_identifier ignore;
  50.   tree global_value, local_value;
  51.   tree class_value;
  52.   struct lang_id2 *x;
  53. };
  54.  
  55. struct lang_id2
  56. {
  57.   tree label_value, implicit_decl;
  58.   tree error_locus;
  59. };
  60.  
  61. /* Macros for access to language-specific slots in an identifier.  */
  62.  
  63. #define IDENTIFIER_GLOBAL_VALUE(NODE)        \
  64.   (((struct lang_identifier *)(NODE))->global_value)
  65. #define IDENTIFIER_CLASS_VALUE(NODE)        \
  66.   (((struct lang_identifier *)(NODE))->class_value)
  67. #define IDENTIFIER_LOCAL_VALUE(NODE)        \
  68.   (((struct lang_identifier *)(NODE))->local_value)
  69. #define IDENTIFIER_AS_LIST(NODE)        \
  70.   ((tree)((struct lang_identifier *)(NODE))->x)
  71. #define SET_IDENTIFIER_AS_LIST(NODE,LIST)    \
  72.   (((struct lang_identifier *)(NODE))->x = (struct lang_id2*)(LIST))
  73.  
  74. #define IDENTIFIER_LABEL_VALUE(NODE)    \
  75.   (((struct lang_identifier *)(NODE))->x \
  76.    ? ((struct lang_identifier *)(NODE))->x->label_value : 0)
  77. #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE)    \
  78.   (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
  79.    ((struct lang_identifier *)(NODE))->x->label_value = (VALUE))
  80. #define IDENTIFIER_IMPLICIT_DECL(NODE)    \
  81.   (((struct lang_identifier *)(NODE))->x \
  82.    ? ((struct lang_identifier *)(NODE))->x->implicit_decl : 0)
  83. #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE)    \
  84.   (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
  85.    ((struct lang_identifier *)(NODE))->x->implicit_decl = (VALUE))
  86. #define IDENTIFIER_ERROR_LOCUS(NODE)    \
  87.   (((struct lang_identifier *)(NODE))->x \
  88.    ? ((struct lang_identifier *)(NODE))->x->error_locus : 0)
  89. #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE)    \
  90.   (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
  91.    ((struct lang_identifier *)(NODE))->x->error_locus = (VALUE))
  92.  
  93. /* Nonzero means reject anything that ANSI standard C forbids.  */
  94. extern int pedantic;
  95.  
  96. /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
  97. #define C_TYPE_FIELDS_READONLY(type) TYPE_SEP_UNIT (type)
  98.  
  99. /* in c-typeck.c */
  100. extern tree build_component_ref(), build_conditional_expr();
  101. extern tree build_x_compound_expr (), build_compound_expr();
  102. extern tree build_unary_op(), build_binary_op(), build_function_call();
  103. extern tree build_binary_op_nodefault ();
  104. extern tree build_indirect_ref(), build_array_ref(), build_c_cast();
  105. extern tree build_modify_expr();
  106. extern tree c_sizeof (), c_alignof ();
  107. extern tree store_init_value ();
  108. extern tree digest_init ();
  109. extern tree c_expand_start_case ();
  110. extern tree default_conversion ();
  111.  
  112. /* Given two integer or real types, return the type for their sum.
  113.    Given two compatible ANSI C types, returns the merged type.  */
  114.  
  115. extern tree commontype ();
  116.  
  117. /* in c-decl.c */
  118. extern tree build_label ();
  119.  
  120. /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
  121.    next exception handler.  */
  122. extern tree exception_throw_decl;
  123.  
  124. extern int start_function ();
  125. extern void finish_function ();
  126. extern void store_parm_decls ();
  127. extern tree get_parm_info ();
  128.  
  129. extern void pushlevel ();
  130. extern tree poplevel ();
  131.  
  132. extern tree groktypename(), lookup_name();
  133.  
  134. extern tree lookup_label(), define_label();
  135.  
  136. extern tree implicitly_declare(), getdecls(), gettags ();
  137.  
  138. extern tree start_decl();
  139. extern void finish_decl();
  140.  
  141. extern tree start_struct(), finish_struct(), xref_tag();
  142. extern tree finish_exception ();
  143. extern tree grokfield(), grokbitfield ();
  144.  
  145. extern tree start_enum(), finish_enum();
  146. extern tree build_enumerator();
  147.  
  148. extern tree make_index_type ();
  149.  
  150. extern tree double_type_node, long_double_type_node, float_type_node;
  151. extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
  152.  
  153. extern tree short_integer_type_node, short_unsigned_type_node;
  154. extern tree long_integer_type_node, long_unsigned_type_node;
  155. extern tree long_long_integer_type_node, long_long_unsigned_type_node;
  156. extern tree unsigned_type_node;
  157. extern tree string_type_node, char_array_type_node, int_array_type_node;
  158.  
  159. extern int current_function_returns_value;
  160. extern int current_function_returns_null;
  161.  
  162. extern tree ridpointers[];
  163.  
  164. /* Nonzero means `$' can be in an identifier.  */
  165.  
  166. extern int dollars_in_ident;
  167.  
  168. /* Nonzero causes a call to __main() to be emmitted as first instruction of */
  169. /* main() */
  170.  
  171. extern int flag__main;
  172.  
  173. /* Nonzero means allow type mismatches in conditional expressions;
  174.    just make their values `void'.   */
  175.  
  176. extern int flag_cond_mismatch;
  177.  
  178. /* Nonzero means don't recognize the keyword `asm'.  */
  179.  
  180. extern int flag_no_asm;
  181.  
  182. /* Nonzero means warn about implicit declarations.  */
  183.  
  184. extern int warn_implicit;
  185.  
  186. /* Nonzero means warn about function definitions that default the return type
  187.    or that use a null return and have a return-type other than void.  */
  188.  
  189. extern int warn_return_type;
  190.  
  191. /* Nonzero means give string constants the type `const char *'
  192.    to get extra warnings from them.  These warnings will be too numerous
  193.    to be useful, except in thoroughly ANSIfied programs.  */
  194.  
  195. extern int warn_write_strings;
  196.  
  197. /* Nonzero means warn about sizeof(function) or addition/subtraction
  198.    of function pointers.  */
  199.  
  200. extern int warn_pointer_arith;
  201.  
  202. /* Nonzero means warn for all old-style non-prototype function decls.  */
  203.  
  204. extern int warn_strict_prototypes;
  205.  
  206. /* Nonzero means warn about pointer casts that can drop a type qualifier
  207.    from the pointer target type.  */
  208.  
  209. extern int warn_cast_qual;
  210.  
  211. /* Nonzero means do some things the same way PCC does.  */
  212.  
  213. extern int flag_traditional;
  214.  
  215. /* 2 means write out only specific virtual function tables
  216.    and give them (C) public visibility.
  217.    1 means write out virtual function tables and give them
  218.    (C) public visibility.
  219.    0 means write out virtual function tables and give them
  220.    (C) static visibility.
  221.    -1 means declare virtual function tables extern.  */
  222.  
  223. extern int write_virtuals;
  224.  
  225. /* Nonzero means that we are in an "interface" section of the compiler.  */
  226. extern int interface_only, interface_unknown;
  227.  
  228. /* Nonzero means we should attempt to elide constructors when possible.  */
  229.  
  230. extern int flag_elide_constructors;
  231.  
  232. /* Nonzero means if the type has methods, only output debugging
  233.    information if methods are actually written to the asm file.  */
  234.  
  235. extern int flag_minimal_debug;
  236.  
  237. /* Nonzero means recognize and handle exception handling constructs.  */
  238.  
  239. extern int flag_handle_exceptions;
  240.  
  241. /* Nonzero means that member functions defined in class scope are
  242.    inline by default.  */
  243.  
  244. extern int flag_default_inline;
  245.  
  246. /* Nonzero means recognize and handle exception handling constructs.  */
  247.  
  248. extern int flag_no_inline;
  249.  
  250. /* Nonzero means emit cadillac protocol.  */
  251.  
  252. extern int flag_cadillac;
  253.  
  254. /* C++ language-specific tree codes.  */
  255. #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
  256. enum cplus_tree_code {
  257.   __DUMMY = LAST_AND_UNUSED_TREE_CODE,
  258. #include "cplus-tree.def"
  259.   LAST_CPLUS_TREE_CODE
  260. };
  261. #undef DEFTREECODE
  262.  
  263. enum languages { lang_c, lang_cplusplus };
  264.  
  265. /* Macros to make error reporting functions' lives easier.  */
  266. #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (NODE))))
  267. #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_NAME (TYPE_NAME (NODE))))
  268.  
  269. /* Virtual function addresses can be gotten from a virtual function
  270.    table entry using this macro.  */
  271. #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
  272.   TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY))))
  273.  
  274. enum conversion_type { ptr_conv, constptr_conv, int_conv, real_conv, last_conversion_type };
  275.  
  276. /* Statistics show that while the GNU C++ compiler may generate
  277.    thousands of different types during a compilation run, it
  278.    generates relatively few (tens) of classtypes.  Because of this,
  279.    it is not costly to store a generous amount of information
  280.    in classtype nodes.  */
  281. struct lang_type
  282. {
  283.   /* This must fill out to a multiple of 4 bytes.  */
  284.   struct
  285.     {
  286.       unsigned has_type_conversion : 1;
  287.       unsigned has_int_conversion : 1;
  288.       unsigned has_float_conversion : 1;
  289.       unsigned has_init_ref : 1;
  290.       unsigned gets_init_ref : 1;
  291.       unsigned gets_init_aggr : 1;
  292.       unsigned has_assignment : 1;
  293.       unsigned gets_assignment : 1;
  294.  
  295.       unsigned has_assign_ref : 1;
  296.       unsigned gets_assign_ref : 1;
  297.       unsigned gets_new : 1;
  298.       unsigned gets_delete : 1;
  299.       unsigned has_wrapper_pred : 1;
  300.       unsigned has_method_call_overloaded : 1;
  301.       unsigned has_call_overloaded : 1;
  302.       unsigned has_array_ref_overloaded : 1;
  303.  
  304.       unsigned any_assigns_this : 1;
  305.       unsigned none_assign_this : 1;
  306.       unsigned marked : 1;
  307.       unsigned marked2 : 1;
  308.       unsigned marked3 : 1;
  309.       unsigned marked4 : 1;
  310.       unsigned marked5 : 1;
  311.       unsigned marked6 : 1;
  312.  
  313.       unsigned virtual_attr : 1;
  314.       unsigned needs_constructor : 1;
  315.       unsigned declared_class : 1;
  316.       unsigned private_attr : 1;
  317.       unsigned const_needs_init : 1;
  318.       unsigned ref_needs_init : 1;
  319.       unsigned uses_virtual_base_classes : 1;
  320.       unsigned uses_multiple_inheritance : 1;
  321.  
  322.       unsigned got_semicolon : 1;
  323.       unsigned alters_visibilities : 1;
  324.       unsigned needs_virtual_reinit : 1;
  325.       unsigned asm_written : 1;
  326.       unsigned declared_exception : 1;
  327.       unsigned vtable_needs_writing : 1;
  328.       unsigned local_typedecls : 1;
  329.       unsigned gets_const_init_ref : 1;
  330.  
  331.       unsigned dynamic : 1;
  332.       unsigned has_default_ctor : 1;
  333.       unsigned gets_const_assign_ref : 1;
  334.       unsigned has_const_assign_ref : 1;
  335.       unsigned interface_only : 1;
  336.       unsigned interface_unknown : 1;
  337.       unsigned dummy3 : 2;
  338.     } type_flags;
  339.  
  340.   unsigned n_parents : 16;
  341.   int cid;
  342.   int n_ancestors;
  343.   int n_vancestors;
  344.   int vsize;
  345.  
  346.   union tree_node *method_vec, *baselink_vec;
  347.   union tree_node *offset;
  348.   union tree_node *vfield, *vfields;
  349.   union tree_node *vbases;
  350.   union tree_node *vbase_size;
  351.  
  352.   union tree_node *tags;
  353.   union tree_node *main_class_variant;
  354.   union tree_node *this_class_variant;
  355.   union tree_node *next_class_variant;
  356.   void *memoized_table_entry;
  357.  
  358.   unsigned char *via_pub_or_virt;
  359.  
  360.   union tree_node **types;
  361.   void *search_slot;
  362.  
  363.   enum machine_mode mode : 8;
  364.   unsigned char size_unit;
  365.   unsigned char align;
  366.   unsigned char sep_unit;
  367.  
  368.   union tree_node *sep;
  369.   union tree_node *size;
  370.  
  371.   union tree_node *base_init_list;
  372.   union tree_node *abstract_virtuals;
  373.   union tree_node *as_list;
  374.   union tree_node *as_id_list;
  375.   union tree_node *vtbl_ptr;
  376.   union tree_node *instance_variable;
  377.   union tree_node *friend_classes;
  378.  
  379.   char *mi_matrix;
  380.   union tree_node *conversions[last_conversion_type];
  381.   union tree_node *wrap_type;
  382.  
  383. #ifdef SOS
  384.   union tree_node *typename_as_string;
  385.   union tree_node *dynamic_filename;
  386.   union tree_node *dynamic_table;
  387. #endif
  388. };
  389.  
  390. /* Fields used for storing information before the class is defined.
  391.    After the class is defined, these fields hold other information.  */
  392.  
  393. /* List of friends which were defined inline in this class definition.  */
  394. #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
  395.  
  396. /* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
  397.    a special meaning for the assignment operator ("operator="),
  398.    or one of its fields (or base members) has a special meaning
  399.    defined.  */
  400. #define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
  401. #define TYPE_GETS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assignment)
  402.  
  403. /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
  404.    respectively.  */
  405. #define TREE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
  406. #define TREE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
  407.  
  408. /* Nonzero for TREE_LIST or _CLASSTYPE node means that the path to the
  409.    base class is via a `public' declaration, which preserves public
  410.    fields from the base class as public.
  411.    OVERLOADED.  */
  412. #define TREE_VIA_PUBLIC(NODE) ((NODE)->common.used_attr) /* overloaded! */
  413.  
  414. /* Nonzero for TREE_LIST node means that the path to the
  415.    base class is via a `protected' declaration, which preserves
  416.    protected fields from the base class as protected.
  417.    OVERLOADED.  */
  418. #define TREE_VIA_PROTECTED(NODE) ((NODE)->common.literal_attr) /* overloaded! */
  419.  
  420. /* Nonzero for a _CLASSTYPE node which we know to be private.  */
  421. #define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)
  422.  
  423. /* Nonzero for a _CLASSTYPE node means that the derivation chain is via
  424.    a `virtual' declaration.  */
  425. #define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.literal_attr) /* overloaded! */
  426.  
  427. /* Nonzero means that this _CLASSTYPE node defines ways of converting
  428.    itself to other types.  */
  429. #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
  430.  
  431. /* Nonzero means that this _CLASSTYPE node can convert itself to an
  432.    INTEGER_TYPE.  */
  433. #define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion)
  434.  
  435. /* Nonzero means that this _CLASSTYPE node can convert itself to an
  436.    REAL_TYPE.  */
  437. #define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion)
  438.  
  439. /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
  440. #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
  441. #define TYPE_GETS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assign_ref)
  442. #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
  443. #define TYPE_GETS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_assign_ref)
  444.  
  445. /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor.  */
  446. #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
  447. #define TYPE_GETS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_ref)
  448. #define TYPE_GETS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_init_ref)
  449.  
  450. /* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
  451.    Note that there must be other arguments, or this constructor is flaged
  452.    as being erroneous.  */
  453. #define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr)
  454.  
  455. /* Nonzero means that this _CLASSTYPE node overloads the method call
  456.    operator.  In this case, all method calls go through `operator->()(...).  */
  457. #define TYPE_OVERLOADS_METHOD_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_method_call_overloaded)
  458.  
  459. #define TYPE_WRAP_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type)
  460.  
  461. #define TYPE_HAS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type == TYPE_MAIN_VARIANT (NODE))
  462. #define TYPE_NEEDS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type != 0 && TYPE_LANG_SPECIFIC(NODE)->wrap_type != TYPE_MAIN_VARIANT (NODE))
  463. #define TYPE_HAS_WRAPPER_PRED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_wrapper_pred)
  464.  
  465. /* Nonzero means that this _CLASSTYPE node overloads operator().  */
  466. #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
  467.  
  468. /* Nonzero means that this _CLASSTYPE node overloads operator[].  */
  469. #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
  470.  
  471. /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
  472.    multiple inheritance.  If this is 0 for the root of a type
  473.    hierarchy, then we can use more efficient search techniques.  */
  474. #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
  475.  
  476. /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
  477.    virtual base classes.  If this is 0 for the root of a type
  478.    hierarchy, then we can use more efficient search techniques.  */
  479. #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_virtual_base_classes)
  480.  
  481. /* List of lists of member functions defined in this class.  */
  482. #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->method_vec)
  483.  
  484. /* Pointer from any member function to the head of the list of
  485.    member functions of the type that member function belongs to.  */
  486. #define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
  487.  
  488. /* Nonzero if the Nth baseclass of this class is via `public'.  */
  489. #define CLASSTYPE_VIA_PUBLIC(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&1)
  490. /* Nonzero if the Nth baseclass of this class is via `virtual'.  */
  491. #define CLASSTYPE_VIA_VIRTUAL(NODE, N) ((TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&2)>>1)
  492.  
  493. /* Accessor macros for the above two constructs.  */
  494. #define CLASSTYPE_VIAS(NODE) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt)
  495. #define SET_CLASSTYPE_VIAS(NODE, N, PUB, VIRT) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N] = (PUB|(VIRT<<1)))
  496.  
  497. /* Mark bits for depth-first and breath-first searches.  */
  498. #define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
  499. #define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
  500. #define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
  501. #define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
  502. #define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
  503. #define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
  504.  
  505. /* When building a matrix to determine by a single lookup
  506.    whether one class is derived from another or not,
  507.    this field is the index of the class in the table.  */
  508. #define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(TYPE_MAIN_VARIANT (NODE))->cid)
  509.  
  510. #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
  511. #define CLASSTYPE_NAMES(NODE) (TYPE_LANG_SPECIFIC(NODE)->names)
  512.  
  513. /* When a class becomes a non-leftmost baseclass in a multiple
  514.    inheritance hierarchy, the number of bytes that subobjects
  515.    of this type are offset from the begining of the containing record.
  516.    This is an INTEGER_CST which holds the value of
  517.    DECL_OFFSET (TYPE_NAME (NODE)).
  518.  
  519.    Note that for virtual base classes, the offset is only meaningful
  520.    for the construction and initialization of virtual baseclass pointers
  521.    and virtual function table entries.  Otherwise, the offset of a
  522.    virtual baseclass is irrelevant, since it is accessed through a
  523.    pointer, and not via a delta.  */
  524. #define CLASSTYPE_OFFSET(NODE) (TYPE_LANG_SPECIFIC (NODE)->offset)
  525.  
  526. /* The virtual function table pointer field.  */
  527. #define CLASSTYPE_VFIELD(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield)
  528. /* The number of virtual functions defined for this
  529.    _CLASSTYPE node.  */
  530. #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
  531. /* The virtual base classes that this type uses.  */
  532. #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
  533. /* The virtual function pointer fields that this type contains.  */
  534. #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
  535.  
  536. /* Number of baseclasses defined for this type.
  537.    0 means no base classes.  */
  538. #define CLASSTYPE_N_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_parents)
  539. /* Vector of base classes for this type.  This vector is
  540.    indexed starting at 1.  */
  541. #define CLASSTYPE_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->types)
  542. /* Accessor macro for the Nth baseclass of type NODE.  */
  543. #define CLASSTYPE_BASECLASS(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->types[N])
  544.  
  545. /* Memoize the number of super classes (base classes) tha this node
  546.    has.  That way we can know immediately (albeit conservatively how
  547.    large a multiple-inheritance matrix we need to build to find
  548.    derivation information.  */
  549. #define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
  550. #define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
  551.  
  552. /* Used for keeping search-specific information.  Any search routine
  553.    which uses this must define what exactly this slot is used for.  */
  554. #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
  555.  
  556. /* The canonical form of this base class.  It also happens to be
  557.    TYPE_MAIN_VARIANT.  */
  558. #define CLASSTYPE_MAIN_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->main_class_variant)
  559. /* For baseclasses with non-zero valued offsets, a chain of
  560.    such versions of this baseclass.  */
  561. #define CLASSTYPE_NEXT_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->next_class_variant)
  562.  
  563. /* Entry for keeping memoization tables for this type to
  564.    hopefully speed up search routines.  Since it is a pointer,
  565.    it can mean almost anything.  */
  566. #define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
  567.  
  568. /* This is the total size of the baseclasses defined for this type.
  569.    Needed because it is desirable to layout such information
  570.    before begining to process the class itself, and we
  571.    don't want to compute it second time when actually laying
  572.    out the type for real.  */
  573. #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
  574. #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
  575. #define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
  576. #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
  577.  
  578. /* This is the space needed for virtual base classes.  */
  579. #define CLASSTYPE_VBASE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbase_size)
  580.  
  581. /* A cons list of structure elements which either have constructors
  582.    to be called, or virtual function table pointers which
  583.    need initializing.  Depending on what is being initialized,
  584.    the TREE_PURPOSE and TREE_VALUE fields have different meanings:
  585.  
  586.    Member initialization: <FIELD_DECL, TYPE>
  587.    Base class construction: <NULL_TREE, BASETYPE>
  588.    Base class initialization: <BASE_INITIALIZAION, THESE_INITIALIZATIONS>
  589.    Whole type: <MEMBER_INIT, BASE_INIT>.  */
  590. #define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
  591.  
  592. /* A cons list of virtual functions which cannot be inherited by
  593.    derived classes.  When deriving from this type, the derived
  594.    class must provide its own definition for each of these functions.  */
  595. #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
  596.  
  597. #define CLASSTYPE_ALTERS_VISIBILITIES_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.alters_visibilities)
  598.  
  599. /* Nonzero means that this aggr type has been `closed' by a semicolon.  */
  600. #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
  601.  
  602. /* Nonzero means that the main virtual function table pointer needs to be
  603.    set because base constructors have placed the wrong value there.
  604.    If this is zero, it means that they placed the right value there,
  605.    and there is no need to change it.  */
  606. #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
  607.  
  608. /* Nonzero means that a member function has actually been output for
  609.    this type.  */
  610. #define CLASSTYPE_ASM_WRITTEN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.asm_written)
  611.  
  612. /* Nonzero means that if this type has virtual functions, that
  613.    the virtual function table will be written out.  */
  614. #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
  615.  
  616. /* Nonzero means that this type defines its own local type declarations.  */
  617. #define CLASSTYPE_LOCAL_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.local_typedecls)
  618.  
  619. /* Nonzero means that this type has an X() constructor.  */
  620. #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
  621.  
  622. /* Many routines need to cons up a list of basetypes for visibility
  623.    checking.  This field contains a TREE_LIST node whose TREE_VALUE
  624.    is the main variant of the type, and whose TREE_VIA_PUBLIC
  625.    and TREE_VIA_VIRTUAL bits are correctly set.  */
  626. #define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
  627. /* Same, but cache a list whose value is the name of this type.  */
  628. #define CLASSTYPE_AS_ID_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_id_list)
  629.  
  630. /* Slot in which to cache a copy of the local vtable pointer.  */
  631. #define CLASSTYPE_VTBL_PTR(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtbl_ptr)
  632.  
  633. /* Hold the instance object associated with this method.  */
  634. #define CLASSTYPE_INST_VAR(NODE) (TYPE_LANG_SPECIFIC(NODE)->instance_variable)
  635.  
  636. /* A list of class types with which this type is a friend.  */
  637. #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
  638.  
  639. /* Keep an inheritance lattice around so we can quickly tell whether
  640.    a type is derived from another or not.  */
  641. #define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
  642.  
  643. /* If there is exactly one conversion to a non-void, non-const pointer type,
  644.    remember that here.  If there are more than one, put
  645.    `error_mark_node' here.  If there are none, this holds NULL_TREE.  */
  646. #define CLASSTYPE_CONVERSION(NODE,KIND) (TYPE_LANG_SPECIFIC(NODE)->conversions[KIND])
  647.  
  648. /* Nonzero means that class is "dynamic" in SOS sense.  (IRIA-specific.)  */
  649. #define TYPE_DYNAMIC(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.dynamic)
  650.  
  651. #ifdef SOS
  652. /* The name of this type as a STRING.  */
  653. #define CLASSTYPE_TYPENAME_AS_STRING(NODE) (TYPE_LANG_SPECIFIC(NODE)->typename_as_string)
  654. /* The name of the file which defines this type.  */
  655. #define CLASSTYPE_DYNAMIC_FILENAME(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_filename)
  656. /* The table of all member functions, linearized.  */
  657. #define CLASSTYPE_DYNAMIC_TABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_table)
  658. #endif
  659.  
  660. /* Say whether this node was declared as a "class" or a "struct".  */
  661. #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
  662. /* Say whether this node was declared as a "class" or a "struct".  */
  663. #define CLASSTYPE_DECLARED_EXCEPTION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_exception)
  664.  
  665. /* Nonzero if this class has const members which have no specified initialization.  */
  666. #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
  667.  
  668. /* Nonzero if this class has ref members which have no specified initialization.  */
  669. #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
  670.  
  671. /* Nonzero if this class is included from a header file which employs
  672.    `#pragma interface', and it is not included in its implementation file.  */
  673. #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
  674.  
  675. /* Same as above, but for classes whose purpose we do not know.  */
  676. #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
  677.  
  678. /* Depending on a class's "owner" they may have different properties,
  679.    such as the offset which must be added to `this', and the
  680.    virtual function table with which they are initialized.  This is
  681.    managed by an association list of type TREE_LIST.  This is
  682.    the interfact to the association list.  */
  683.  
  684. /* The class's virtual function table.  */
  685. #define ASSOC_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
  686. #define CLASS_ASSOC_VTABLE(NODE) ASSOC_VTABLE (TYPE_BASETYPES (NODE))
  687.  
  688. /* The virtual functions in the virtual function table.  */
  689. #define ASSOC_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
  690. #define CLASS_ASSOC_VIRTUALS(NODE) ASSOC_VIRTUALS (TYPE_BASETYPES (NODE))
  691.  
  692. /* The class's offset to be added to `this'.  */
  693. #define ASSOC_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
  694. #define CLASS_ASSOC_OFFSET(NODE) ASSOC_OFFSET (TYPE_BASETYPES (NODE))
  695.  
  696. /* The association key.  */
  697. #define ASSOC_VALUE(NODE) TREE_VEC_ELT ((NODE), 0)
  698. /* And its specific value.  */
  699. #define ASSOC_TYPE(NODE) TREE_TYPE (NODE)
  700.  
  701. #define CLASSTYPE_ASSOC(NODE) (TYPE_BASETYPES (NODE))
  702.  
  703. /* Nonzero for TREE_LIST node means that this list of things
  704.    is a list of parameters, as opposed to a list of expressions.  */
  705. #define TREE_PARMLIST(NODE) TREE_UNSIGNED (NODE) /* overloaded! */
  706.  
  707. /* Nonzero for FIELD_DECL node means that this FIELD_DECL is
  708.    a member of an anonymous union construct.  The name of the
  709.    union is .  */
  710. #define TREE_ANON_UNION_ELEM(NODE) TREE_REGDECL (NODE) /* overloaded! */
  711.  
  712. /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
  713.    this type can raise.  */
  714. #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
  715.  
  716. struct lang_decl_flags
  717. {
  718.   enum languages language : 8;
  719.  
  720.   unsigned this_private : 1;
  721.   unsigned this_protected : 1;
  722.   unsigned this_public : 1;
  723.   unsigned operator_attr : 1;
  724.   unsigned overloaded_attr : 1;
  725.   unsigned constructor_attr : 1;
  726.   unsigned returns_first_arg : 1;
  727.   unsigned preserves_first_arg : 1;
  728.  
  729.   unsigned in_aggr : 1;
  730.   unsigned friend_attr : 1;
  731.   unsigned static_function : 1;
  732.   unsigned const_memfunc : 1;
  733.   unsigned volatile_memfunc : 1;
  734.   unsigned abstract_virtual : 1;
  735.   unsigned compiler_generated : 1;
  736.   unsigned permanent_attr : 1 ;
  737.   unsigned constructor_for_vbase_attr : 1;
  738.   unsigned dummy7 : 7;
  739.  
  740.   tree visibility;
  741. };
  742.  
  743. struct lang_decl
  744. {
  745.   struct lang_decl_flags decl_flags;
  746.  
  747.   tree original_name;
  748.   tree vindex;
  749.   tree vcontext;
  750.   tree main_decl_variant;
  751.   struct pending_inline *pending_inline_info;
  752.   union tree_node *vbase_init_list;
  753.  
  754. #ifdef SOS
  755.   tree dynamic_index;
  756. #endif
  757. };
  758.  
  759. /* Non-zero if NODE is a _DECL with TREE_READONLY set.  */
  760. #define TREE_READONLY_DECL_P(NODE) \
  761.   (TREE_READONLY (NODE) && *(tree_code_type[TREE_CODE (NODE)]) == 'd')
  762.  
  763. /* For FUNCTION_DECLs: return the language in which this decl
  764.    was declared.  */
  765. #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
  766.  
  767. /* For FUNCTION_DECLs: nonzero means that this function is a constructor.  */
  768. #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
  769. /* For FUNCTION_DECLs: nonzero means that this function is a constructor
  770.    for an object with virtual baseclasses.  */
  771. #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
  772.  
  773. /* For FUNCTION_DECLs: nonzero means that the constructor
  774.    is known to return a non-zero `this' unchanged.  */
  775. #define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
  776.  
  777. /* Nonzero for FUNCTION_DECL means that this constructor is known to
  778.    not make any assignment to `this', and therefore can be trusted
  779.    to return it unchanged.  Otherwise, we must re-assign `current_class_decl'
  780.    after performing base initializations.  */
  781. #define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
  782.  
  783. /* Nonzero for _DECL means that this decl appears in (or will appear
  784.    in) as a member in a RECORD_TYPE or UNION_TYPE node.  It is also for
  785.    detecting circularity in case members are multiply defined.  In the
  786.    case of a VAR_DECL, it is also used to determince how program storage
  787.    should be allocated.  */
  788. #define DECL_IN_AGGR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.in_aggr)
  789.  
  790. /* Nonzero for FUNCTION_DECL means that this decl is just a
  791.    friend declaration, and should not be added to the list of
  792.    member functions for this class.  */
  793. #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
  794.  
  795. /* Nonzero for FUNCTION_DECL means that this decl is a static
  796.    member function.  */
  797. #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
  798.  
  799. /* Nonzero for FUNCTION_DECL means that this member function
  800.    has `this' as const X *const.  */
  801. #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
  802.  
  803. /* Nonzero for FUNCTION_DECL means that this member function
  804.    has `this' as volatile X *const.  */
  805. #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
  806.  
  807. /* Nonzero for FUNCTION_DECL means that this member function
  808.    exists only as part of an abstract class's interface.  */
  809. #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
  810.  
  811. /* Nonzero for FUNCTION_DECL means that this member function
  812.    was generated by the compiler.  This helps us give better
  813.    error messages.  */
  814. #define DECL_COMPILER_GENERATED_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.compiler_generated)
  815.  
  816. /* Nonzero if allocated on permanent_obstack.  */
  817. #if 0
  818. /* @@ Not currently used.  */
  819. #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
  820. #endif
  821.  
  822. /* Nonzero for FIELD_DECL node means that this FIELD_DECL is
  823.    a member of an anonymous union construct.  */
  824. #define DECL_ANON_UNION_ELEM(NODE) TREE_REGDECL (NODE) /* overloaded! */
  825.  
  826. /* For a FUNCTION_DECL: the name of the function before being overloaded.  */
  827. #define DECL_ORIGINAL_NAME(NODE) (DECL_LANG_SPECIFIC(NODE)->original_name)
  828.  
  829. /* Points back to the decl which caused this lang_decl to be allocated.  */
  830. #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
  831.  
  832. /* For a FUNCTION_DECL: if this function was declared inline inside of
  833.    a class declaration, this is where the text for the function is
  834.    squirreled away.  */
  835. #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
  836.  
  837. /* Holds information about how virtual base classes should be initialized
  838.    by this constructor *if* this constructor is the one to perform
  839.    such initialization.  */
  840. #define DECL_VBASE_INIT_LIST(NODE) (DECL_LANG_SPECIFIC(NODE)->vbase_init_list)
  841.  
  842. /* Nonzero in INT_CST means that this int is negative by dint of
  843.    using a twos-complement negated operand.  */
  844. #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_1 (NODE))
  845.  
  846. /* Nonzero in any kind of _EXPR or _REF node means that it is a call
  847.    to a storage allocation routine.  If, later, alternate storage
  848.    is found to hold the object, this call can be ignored.  */
  849. #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_2 (NODE))
  850.  
  851. /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
  852.    should be looked up in a non-standard way.  */
  853. #define TREE_OVERLOADED(NODE) (TREE_LANG_FLAG_1 (NODE))
  854. #define DECL_OVERLOADED(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.overloaded_attr)
  855.  
  856. /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
  857.    For a FUNCTION_DECL, this is when the function is a virtual function.
  858.    For a VAR_DECL, this is when the variable is a virtual function table.
  859.    For a FIELD_DECL, when the field is the field for the virtual function table.
  860.    For an IDENTIFIER_NODE, nonzero if any function with this name
  861.    has been declared virtual.  */
  862. #define DECL_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
  863.  
  864. /* Nonzero for FIELD_DECL means that this field is a
  865.    virtual baseclass field.  Used for printing debugging info.  */
  866. #define DECL_VBASE_P(NODE) ((NODE)->common.external_attr)
  867.  
  868. /* Nonzero for FIELD_DECLs means that this field is private,
  869.    and can only be accessed within the scope of the class
  870.    which defines it (or its friends).  */
  871. #define TREE_PRIVATE(NODE) (TREE_LANG_FLAG_3 (NODE))
  872. /* Same, but tells if this field is private in current context.  */
  873. #define TREE_FIELD_PRIVATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_private)
  874.  
  875. /* Nonzero for FIELD_DECLs means that this field is protected,
  876.    and can only be accessed within the scope of the class
  877.    which defines it, its friends, or if there is a path in
  878.    the type hierarchy from the current class scope to
  879.    the one that defines it. */
  880. #define TREE_PROTECTED(NODE) (TREE_LANG_FLAG_4 (NODE))
  881. /* Same, but tells if this field is private in current context.  */
  882. #define TREE_FIELD_PROTECTED(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_protected)
  883.  
  884. #define TREE_FIELD_PUBLIC(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_public)
  885.  
  886. /* Nonzero for _TYPE means that the _TYPE defines
  887.    at least one constructor.  */
  888. #define TYPE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))
  889.  
  890. /* When appearing in an INDIRECT_REF, it means that the tree structure
  891.    underneath is actually a call to a constructor.  This is needed
  892.    when the constructor must initialize local storage (which can
  893.    be automatically destroyed), rather than allowing it to allocate
  894.    space from the heap.
  895.  
  896.    When appearing in a SAVE_EXPR, it means that underneath
  897.    is a call to a constructor.
  898.  
  899.    When appearing in a CONSTRUCTOR, it means that it was
  900.    a GNU C constructor expression.
  901.  
  902.    When appearing in a FIELD_DECL, it means that this field
  903.    has been duly initialized in its constructor.  */
  904. #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))
  905.  
  906. /* Nonzero for _TYPE means that the _TYPE defines a destructor.  */
  907. #define TYPE_HAS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_2(NODE))
  908.  
  909. /* Nonzero for _TYPE node means that creating an object of this type
  910.    will involve a call to a constructor.  This can apply to objects
  911.    of ARRAY_TYPE if the type of the elements needs a constructor.  */
  912. #define TYPE_NEEDS_CONSTRUCTING(NODE) (TREE_LANG_FLAG_3(NODE))
  913. #define TYPE_NEEDS_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_constructor)
  914.  
  915. /* Nonzero for _TYPE node means that destroying an object of this type
  916.    will involve a call to a destructor.  This can apply to objects
  917.    of ARRAY_TYPE is the type of the elements needs a destructor.  */
  918. #define TYPE_NEEDS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
  919.  
  920. /* Nonzero for VAR_DECL node means that `external' was specified in
  921.    its declaration.  */
  922. #define DECL_EXTERNAL(NODE) (TREE_LANG_FLAG_1(NODE))
  923.  
  924. /* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL.  */
  925. #define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
  926.  
  927. /* Nonzero in FUNCTION_DECL means it is really an operator.
  928.    Just used to communicate formatting information to dbxout.c.  */
  929. #define TREE_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
  930.  
  931. /* Nonzero for _TYPEs means that the argument defines or uses a
  932.    virtual function table for some of its methods.  */
  933. #define TYPE_VIRTUAL_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.virtual_attr)
  934.  
  935. /* May be useful for optimization using strictness analysis.
  936.    TYPE_ANY_ASSIGNS_THIS nonzero means that there is one constructor
  937.    within the hierarchy of TYPE which is known to assign to `this'.
  938.  
  939.    TYPE_NONE_ASSIGNS_THIS nonzero means that it is known that
  940.    no constructor within the hierarchy of TYPE makes an assignment
  941.    to `this'.
  942.  
  943.    Both of these can be zero, in which case it just means that we don't
  944.    have sufficient information yet.  They cannot, however, both be nonzero.  */
  945. #define TYPE_ANY_ASSIGNS_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.any_assigns_this)
  946. #define TYPE_NONE_ASSIGN_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.none_assign_this)
  947.  
  948. /* Define fields and accessors for nodes representing declared names.  */
  949.  
  950. /* C++: A derived class may be able to directly use the virtual
  951.    function table of a base class.  When it does so, it may
  952.    still have a decl node used to access the virtual function
  953.    table (so that variables of this type can initialize their
  954.    virtual function table pointers by name).  When such thievery
  955.    is commited, know exactly which base class's virtual function
  956.    table is the one being stolen.  This effectively computes the
  957.    transitive closure.  */
  958. #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
  959.  
  960. /* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
  961. #define DECL_FRIENDLIST(NODE) ((NODE)->decl.voffset)
  962. #define DECL_UNDEFINED_FRIENDS(NODE) ((NODE)->decl.context)
  963. #define DECL_WAITING_FRIENDS(NODE) ((tree)(NODE)->decl.rtl)
  964. #define SET_DECL_WAITING_FRIENDS(NODE,VALUE) ((NODE)->decl.rtl=(struct rtx_def*)VALUE)
  965.  
  966. /* C++: all of these are overloaded! These apply only to FIELD_DECLs.  */
  967. #define DECL_STATIC_NAME(NODE) ((tree)(NODE)->decl.offset)
  968. #define SET_DECL_STATIC_NAME(NODE,VAL) ((NODE)->decl.offset = (int)VAL)
  969.  
  970. /* The DECL_VISIBILITY is used to record under which context
  971.    special visibility rules apply.  */
  972. #define DECL_VISIBILITY(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.visibility)
  973.  
  974. /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
  975.    Before the struct containing the FUNCTION_DECL is laid out,
  976.    DECL_VINDEX may point to a FUNCTION_DECL in a base class which
  977.    is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
  978.    function.  When the class is laid out, this pointer is changed
  979.    to an INT_CST node which is suitable for use as an index
  980.    into the virtual function table.  */
  981. #define DECL_VINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->vindex)
  982. #define SET_DECL_VINDEX(NODE,VAL) (DECL_LANG_SPECIFIC(NODE)->vindex = VAL)
  983.  
  984. /* DECL_VCONTEXT is the *first* baseclass in which this FUNCTION_DECL
  985.    is defined.  Contrast this with DECL_CONTEXT (or DECL_FIELD_CONTEXT),
  986.    which is the *last* such baseclass.  */
  987. #define DECL_VCONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)
  988.  
  989. /* DECL_FCONTEXT is the *first* baseclass in which this FIELD_DECL
  990.    is defined.  This only applies to vfield and vbase decls.  */
  991. #define SET_DECL_FCONTEXT(NODE,VALUE) (DECL_LANG_SPECIFIC(NODE) = (struct lang_decl *)(VALUE))
  992. #define DECL_FCONTEXT(NODE) ((tree)DECL_LANG_SPECIFIC(NODE))
  993.  
  994. /* For static member functions, which can never be virtual,
  995.    we need to know to what class the method belongs.  This
  996.    is where we stash the information.  */
  997. #define DECL_STATIC_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)
  998.  
  999. /* C++: all of these are overloaded!
  1000.    These apply to PARM_DECLs and VAR_DECLs and RESULT_DECLs.  */
  1001. #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
  1002. #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
  1003.  
  1004. #ifdef SOS
  1005. #define DECL_DINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->dynamic_index)
  1006. #endif
  1007.  
  1008. /* An enumeration of the kind of tags that C++ accepts.  */
  1009. enum tag_types { record_type, class_type, union_type, enum_type, exception_type };
  1010.  
  1011. /* Zero means prototype weakly, as in ANSI C (no args means nothing).
  1012.    Each language context defines how this variable should be set.  */
  1013. extern int strict_prototype;
  1014. extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
  1015.  
  1016. /* Non-zero means that if a label exists, and no other identifier
  1017.    applies, use the value of the label.  */
  1018. extern int flag_labels_ok;
  1019.  
  1020. /* Non-zero means to collect statistics which might be expensive
  1021.    and to print them when we are done.  */
  1022. extern int flag_detailed_statistics;
  1023.  
  1024. /* Non-zero means warn in function declared in derived class has the
  1025.    same name as a virtual in the base class, but fails to match the
  1026.    type signature of any virtual function in the base class.  */
  1027. extern int warn_overloaded_virtual;
  1028.  
  1029. /* in cplus-decl{2}.c */
  1030. extern tree void_list_node;
  1031. extern tree default_function_type;
  1032. extern tree define_function ();
  1033. extern tree build_member_type ();
  1034.  
  1035. extern tree vtable_entry_type;
  1036. extern tree build_vtable_entry ();
  1037. extern tree build_vfn_ref ();
  1038. extern tree finish_table ();
  1039.  
  1040. extern tree typedecl_for_tag ();
  1041. extern tree identifier_class_value ();
  1042.  
  1043. extern int complete_array_type ();
  1044. extern tree coerce_new_type (), coerce_delete_type ();
  1045.  
  1046. /* A node that is a list (length 1) of error_mark_nodes.  */
  1047. extern tree error_mark_list;
  1048.  
  1049. extern tree ptr_type_node;
  1050. extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
  1051. extern tree exception_type_node, unknown_type_node;
  1052.  
  1053. extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
  1054. extern tree cleanup_after_call ();
  1055. extern tree build_type_conversion ();
  1056. extern tree convert_force ();
  1057. extern tree maybe_convert_decl_to_const ();
  1058. extern char *lang_printable_name ();
  1059.  
  1060. /* The largest size a virtual function table can be.
  1061.    Must be a (power of 2).  */
  1062. #ifndef VINDEX_MAX
  1063. #define VINDEX_MAX ((unsigned)128)
  1064. /* This is the integer ~ (vindex_max - 1).  */
  1065. #endif
  1066. extern tree vtbl_mask;
  1067.  
  1068. /* Array type `(void *)[]' */
  1069. extern tree vtbl_type_node;
  1070.  
  1071. extern tree get_parm_types ();
  1072. extern tree grokopexpr (), getaggrs (), groktypefield ();
  1073. extern tree grok_method_quals (), grok_enum_decls ();
  1074. extern void finish_anon_union();
  1075. extern tree long_long_integer_type_node, long_long_unsigned_type_node;
  1076. /* For building calls to `delete'.  */
  1077. extern tree integer_two_node, integer_three_node;
  1078. extern tree get_first_matching_virtual (), get_abstract_virtuals ();
  1079.  
  1080. /* in cplus-typeck.c */
  1081. extern tree build_x_conditional_expr ();
  1082. extern tree merge_component_comparisons ();
  1083. extern tree build_x_unary_op (), build_x_binary_op ();
  1084. extern tree build_component_addr ();
  1085. extern tree build_x_function_call ();
  1086. extern tree build_x_indirect_ref (), build_x_array_ref ();
  1087. extern tree build_x_modify_expr (), build_x_modify_op_expr ();
  1088.  
  1089. extern tree build_m_component_ref ();
  1090. extern tree build_component_type_expr ();
  1091. extern tree build_x_arrow ();
  1092. extern tree build_component_ref_1 ();
  1093. extern tree datatype (), unary_complex_lvalue (), target_type ();
  1094. extern tree build_return_stmt ();
  1095. extern tree actualparameterlist (), commonparms ();
  1096. extern tree cplus_size_in_bytes ();
  1097. extern tree cplus_sizeof (), cplus_sizeof_nowarn ();
  1098. extern tree error_mark_list;
  1099.  
  1100. /* in cplus-type2.c */
  1101. extern tree basetype_or_else ();
  1102.  
  1103. /* in tree.c */
  1104. extern tree build_let ();
  1105. extern tree decl_type_context ();
  1106.  
  1107. /* in cplus-tree.c */
  1108. extern tree build1 ();
  1109. extern tree build_cplus_new ();
  1110. extern tree build_cplus_array_type ();
  1111. extern tree build_cplus_method_type ();
  1112. extern tree build_classtype_variant ();
  1113. extern tree hash_tree_cons (), hash_tree_chain ();
  1114. extern tree list_hash_lookup_or_cons ();
  1115. extern tree layout_basetypes ();
  1116. extern tree copy_to_permanent ();
  1117.  
  1118. /* in cplus-except.c */
  1119. extern tree current_exception_type;
  1120. extern tree current_exception_decl;
  1121. extern tree current_exception_object;
  1122. extern tree build_exception_variant ();
  1123. extern tree lookup_exception_type (), lookup_exception_cname ();
  1124. extern tree lookup_exception_object ();
  1125. extern tree cplus_expand_start_catch ();
  1126. extern tree cplus_expand_end_try ();
  1127.  
  1128. /* in cplus-class.c */
  1129. extern tree current_class_name;
  1130. extern tree current_class_type;
  1131. extern tree prev_class_type;
  1132.  
  1133. extern tree current_lang_name, lang_name_cplusplus, lang_name_c;
  1134.  
  1135. extern tree do_identifier (), hack_identifier ();
  1136. extern tree hack_operator (), hack_wrapper ();
  1137. extern tree convert_pointer_to (), convert_pointer_to_vbase ();
  1138. extern tree convert_to_reference (), convert_to_aggr (), convert_aggr ();
  1139. extern tree build_x_new (), build_x_delete ();
  1140. extern tree build_new (), build_vec_new (), build_delete (), build_vec_delete ();
  1141. extern tree make_destructor_name ();
  1142. extern tree build_scoped_ref (), build_vfield_ref ();
  1143. extern tree build_method_call (), build_overload_call ();
  1144. extern tree build_type_pathname ();
  1145. extern tree start_method (), start_type_method ();
  1146. extern tree finish_method ();
  1147.  
  1148. extern tree lookup_field (), lookup_fnfields ();
  1149.  
  1150. void pushclass (), popclass (), pushclasstype ();
  1151. extern tree build_operator_fnname (), build_opfncall (), build_type_conversion ();
  1152. extern tree build_wrapper ();
  1153.  
  1154. /* Points to the name of that function. May not be the DECL_NAME
  1155.    of CURRENT_FUNCTION_DECL due to overloading */
  1156. extern tree original_function_name;
  1157.  
  1158. # define IS_AGGR_TYPE(t) \
  1159.   (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == UNION_TYPE)
  1160.  
  1161. # define IS_AGGR_TYPE_CODE(t) \
  1162.   (t == RECORD_TYPE || t == UNION_TYPE)
  1163.  
  1164. extern tree build_decl_overload (), build_typename_overload ();
  1165. extern tree build_destructor_call ();
  1166. extern tree current_class_name, current_class_type, current_class_decl, C_C_D;
  1167. extern tree current_vtable_decl;
  1168.  
  1169. /* in cplus-init.c  */
  1170. extern tree resolve_offset_ref ();
  1171. extern tree purpose_member (), value_member ();
  1172. extern void check_base_init ();
  1173. extern void do_member_init ();
  1174. extern tree global_base_init_list;
  1175. extern tree current_base_init_list, current_member_init_list;
  1176. #ifdef SOS
  1177. extern tree get_linktable_name (), get_dtable_name (), get_sos_dtable ();
  1178. #endif
  1179. extern tree get_member_function ();
  1180. extern tree build_member_call (), build_offset_ref ();
  1181.  
  1182. extern int current_function_assigns_this;
  1183. extern int current_function_just_assigned_this;
  1184. extern int current_function_parms_stored;
  1185.  
  1186. /* Cannot use '$' up front, because this confuses gdb.
  1187.    Note that any format of this kind *must* make the
  1188.    format for `this' lexicgraphically less than any other
  1189.    parameter name, i.e. "$this" is less than anything else can be.
  1190.  
  1191.    Note that all forms in which the '$' is significant are long enough
  1192.    for direct indexing.  */
  1193.  
  1194. /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
  1195.    doesn't allow '$' in symbol names.  */
  1196. #ifndef NO_DOLLAR_IN_LABEL
  1197.  
  1198. #define JOINER '$'
  1199.  
  1200. #define THIS_NAME "$t"
  1201. #define VPTR_NAME "$v"
  1202. #define THROW_NAME "$eh_throw"
  1203. #define DESTRUCTOR_DECL_FORMAT "_$_%s"
  1204. #define WRAPPER_DECL_FORMAT "__W$%s"
  1205. #define WRAPPER_PRED_DECL_FORMAT "__P$%s"
  1206. #define ANTI_WRAPPER_DECL_FORMAT "__w$%s"
  1207. #define IN_CHARGE_NAME "__in$chrg"
  1208. #define AUTO_VTABLE_NAME "__vtbl$me__"
  1209. #define AUTO_TEMP_NAME "_$tmp_"
  1210. #define AUTO_TEMP_FORMAT "_$tmp_%d"
  1211. #define OPERATOR_ASSIGN_FORMAT "op$assign_%s"
  1212. #define OPERATOR_MODIFY_FORMAT "op$modify"
  1213. #define OPERATOR_METHOD_FORMAT "op$method_call"
  1214. #define OPERATOR_NEW_FORMAT "op$new"
  1215. #define OPERATOR_DELETE_FORMAT "op$delete"
  1216. #define OPERATOR_FORMAT "op$%s"
  1217. #define VTBL_PTR_TYPE "$vtbl_ptr_type"
  1218. #define VTABLE_NAME_FORMAT "_vt$%s"
  1219. #define VFIELD_NAME "_vptr$"
  1220. #define VFIELD_NAME_FORMAT "_vptr$%s"
  1221. #define VBASE_NAME "_vb$"
  1222. #define VBASE_NAME_FORMAT "_vb$%s"
  1223. #define STATIC_NAME_FORMAT "_%s$%s"
  1224. #define OPERATOR_TYPENAME_FORMAT "type$"
  1225. #define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
  1226. #define ANON_AGGRNAME_FORMAT "$_%d"
  1227.  
  1228. #else    /* NO_DOLLAR_IN_LABEL */
  1229.  
  1230. #define JOINER '.'
  1231.  
  1232. #define THIS_NAME ".t"
  1233. #define VPTR_NAME ".v"
  1234. #define THROW_NAME ".eh_throw"
  1235. #define DESTRUCTOR_DECL_FORMAT "_._%s"
  1236. #define WRAPPER_DECL_FORMAT "__W.%s"
  1237. #define WRAPPER_PRED_DECL_FORMAT "__P.%s"
  1238. #define ANTI_WRAPPER_DECL_FORMAT "__w.%s"
  1239. #define IN_CHARGE_NAME "__in.chrg"
  1240. #define AUTO_VTABLE_NAME "__vtbl.me__"
  1241. #define AUTO_TEMP_NAME "_.tmp_"
  1242. #define AUTO_TEMP_FORMAT "_.tmp_%d"
  1243. #define OPERATOR_ASSIGN_FORMAT "op.assign_%s"
  1244. #define OPERATOR_MODIFY_FORMAT "op.modify"
  1245. #define OPERATOR_METHOD_FORMAT "op.method_call"
  1246. #define OPERATOR_NEW_FORMAT "op.new"
  1247. #define OPERATOR_DELETE_FORMAT "op.delete"
  1248. #define OPERATOR_FORMAT "op.%s"
  1249. #define VTBL_PTR_TYPE ".vtbl_ptr_type"
  1250. #define VTABLE_NAME_FORMAT "_vt.%s"
  1251. #define VFIELD_NAME "_vptr."
  1252. #define VFIELD_NAME_FORMAT "_vptr.%s"
  1253. #define VBASE_NAME "_vb."
  1254. #define VBASE_NAME_FORMAT "_vb.%s"
  1255. #define STATIC_NAME_FORMAT "_%s.%s"
  1256. #define OPERATOR_TYPENAME_FORMAT "type."
  1257. #define FILE_FUNCTION_FORMAT "_GLOBAL_.D.%s"
  1258.  
  1259. #define ANON_AGGRNAME_FORMAT "._%d"
  1260.  
  1261. #endif    /* NO_DOLLAR_IN_LABEL */
  1262.  
  1263. #define DESTRUCTOR_NAME_FORMAT "~%s"
  1264. #define WRAPPER_NAME_FORMAT "()%s"
  1265. #define WRAPPER_PRED_NAME_FORMAT "()?%s"
  1266. #define ANTI_WRAPPER_NAME_FORMAT "~()%s"
  1267. #define OPERATOR_MODIFY_LENGTH 8
  1268. #define OPERATOR_METHOD_LENGTH 13
  1269. #define OPERATOR_NEW_LENGTH 5
  1270. #define OPERATOR_DELETE_LENGTH 8
  1271. #define EXCEPTION_NAME_LENGTH 12
  1272. #define FILE_FUNCTION_PREFIX_LEN 9
  1273. #define VTABLE_DELTA_NAME "delta"
  1274. #define VTABLE_DELTA2_NAME "delta2"
  1275. #define VTABLE_INDEX_NAME "index"
  1276. #define VTABLE_PFN_NAME "pfn"
  1277. #define EXCEPTION_CLEANUP_NAME "exception cleanup"
  1278.  
  1279. #define THIS_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
  1280.                   && IDENTIFIER_POINTER (ID_NODE)[1] == 't')
  1281. #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
  1282.                   && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
  1283. #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER)
  1284.  
  1285. #define WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
  1286.                  && IDENTIFIER_POINTER (ID_NODE)[2] == 'W' \
  1287.                  && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
  1288. #define WRAPPER_PRED_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
  1289.                  && IDENTIFIER_POINTER (ID_NODE)[2] == 'P' \
  1290.                  && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
  1291. #define ANTI_WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
  1292.                       && IDENTIFIER_POINTER (ID_NODE)[2] == 'w' \
  1293.                       && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
  1294. #define WRAPPER_OR_ANTI_WRAPPER_NAME_P(ID_NODE) \
  1295.   (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
  1296.    && (IDENTIFIER_POINTER (ID_NODE)[2]|('W'^'w')) == 'w' \
  1297.    && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
  1298.  
  1299. #define OPERATOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[2] == JOINER \
  1300.   && IDENTIFIER_POINTER (ID_NODE)[1])
  1301.  
  1302. #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
  1303.   && IDENTIFIER_POINTER (ID_NODE)[2] == 't'\
  1304.   && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
  1305.  
  1306. #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
  1307.   && IDENTIFIER_POINTER (ID_NODE)[2] == 'b'\
  1308.   && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
  1309.  
  1310. #define OPERATOR_TYPENAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[4] == JOINER \
  1311.   && IDENTIFIER_POINTER (ID_NODE)[3] \
  1312.   && IDENTIFIER_POINTER (ID_NODE)[2] \
  1313.   && IDENTIFIER_POINTER (ID_NODE)[1])
  1314.  
  1315. #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
  1316. #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
  1317.  
  1318. /* For anonymous aggregate types, we need some sort of name to
  1319.    hold on to.  In practice, this should not appear, but it should
  1320.    not be harmful if it does.  */
  1321. #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER)
  1322.  
  1323. #define ANON_PARMNAME_FORMAT "_%d"
  1324. #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
  1325.                   && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
  1326.  
  1327. enum visibility_type {
  1328.   visibility_default,
  1329.   visibility_public,
  1330.   visibility_private,
  1331.   visibility_protected,
  1332.   visibility_default_virtual,
  1333.   visibility_public_virtual,
  1334.   visibility_private_virtual,
  1335. };
  1336.  
  1337. enum visibility_type compute_visibility ();
  1338.  
  1339. /* in cplus-lex.c  */
  1340. extern tree current_unit_name, current_unit_language;
  1341. extern char *operator_name_string ();
  1342.  
  1343. /* Things for handling inline functions.  */
  1344.  
  1345. struct pending_inline
  1346. {
  1347.   struct pending_inline *next;    /* pointer to next in chain */
  1348.   int lineno;            /* line number we got the text from */
  1349.   char *filename;        /* name of file we were processing */
  1350.   tree fndecl;            /* FUNCTION_DECL that brought us here */
  1351.   int token;            /* token we were scanning */
  1352.   int token_value;        /* value of token we were scanning (YYSTYPE) */
  1353.  
  1354.   char *buf;            /* pointer to character stream */
  1355.   int len;            /* length of stream */
  1356. };
  1357.  
  1358. extern tree combine_strings ();
  1359. extern int yylex ();
  1360.  
  1361. /* in cplus-method.c */
  1362. extern tree wrapper_name, wrapper_pred_name, anti_wrapper_name;
  1363. extern struct pending_inline *pending_inlines;
  1364. extern char *print_fndecl_with_types ();
  1365.  
  1366. /* 1 for -fall-virtual: make every member function (except
  1367.    constructors) lay down in the virtual function table.
  1368.    Calls can then either go through the virtual function table or not,
  1369.    depending on whether we know what function will actually be called.
  1370.  
  1371.    2 for -fSOS: make every member function (including constructors)
  1372.    lay down in the virtual function table.  All calls go through the
  1373.    virtual function table: this takes the place of using a linker.  */
  1374.  
  1375. extern int flag_all_virtual;
  1376.  
  1377. /* Nonzero means that we cannot make optimizing assumptions about `this'.  */
  1378.  
  1379. extern int flag_this_is_variable;
  1380.  
  1381. enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG, WRAPPER_FLAG, WRAPPER_PRED_FLAG, ANTI_WRAPPER_FLAG };
  1382.  
  1383. extern tree default_conversion (), pushdecl (), pushdecl_top_level ();
  1384. extern tree make_instance_name (), do_decl_overload ();
  1385. extern tree maybe_build_cleanup ();
  1386. extern tree build_instantiated_decl (), instantiate_type ();
  1387. extern tree require_instantiated_type ();
  1388. extern tree build_vtbl_ref ();
  1389. extern tree make_anon_parm_name ();
  1390. extern int resolves_to_fixed_type_p ();
  1391.  
  1392. extern tree do_friend ();
  1393. extern void grokclassfn ();
  1394.  
  1395. extern tree current_class_decl, C_C_D;    /* PARM_DECL: the class instance variable */
  1396.  
  1397. /* The following two can be derived from the previous one */
  1398. extern tree current_class_name;    /* IDENTIFIER_NODE: name of current class */
  1399. extern tree current_class_type;    /* _TYPE: the type of the current class */
  1400.  
  1401. /* The following structure is used when comparing various alternatives
  1402.    for overloading.  The unsigned quantity `strikes.i' is used
  1403.    for fast comparison of two possibilities.  This number is an
  1404.    aggregate of four constituents:
  1405.  
  1406.      EVIL: if this is non-zero, then the candidate should not be considered
  1407.      USER: if this is non-zero, then a user-defined type conversion is needed
  1408.      B_OR_D: if this is non-zero, then use a base pointer instead of the
  1409.              type of the pointer we started with.
  1410.      EASY: if this is non-zero, then we have a builtin conversion
  1411.            (such as int to long, int to float, etc) to do.
  1412.  
  1413.    If two candidates require user-defined type conversions, and the
  1414.    type conversions are not identical, then an ambiguity error
  1415.    is reported.
  1416.  
  1417.    If two candidates agree on user-defined type conversions,
  1418.    and one uses pointers of strictly higher type (derived where
  1419.    another uses base), then that alternative is silently chosen.
  1420.  
  1421.    If two candidates have a non-monotonic derived/base pointer
  1422.    relationship, and/or a non-monotonic easy conversion relationship,
  1423.    then a warning is emitted to show which paths are possible, and
  1424.    which one is being chosen.
  1425.  
  1426.    For example:
  1427.  
  1428.    int i;
  1429.    double x;
  1430.  
  1431.    overload f;
  1432.    int f (int, int);
  1433.    double f (double, double);
  1434.  
  1435.    f (i, x);    // draws a warning
  1436.  
  1437.    struct B
  1438.    {
  1439.      f (int);
  1440.    } *bb;
  1441.    struct D : B
  1442.    {
  1443.      f (double);
  1444.    } *dd;
  1445.  
  1446.    dd->f (x);    // exact match
  1447.    dd->f (i);    // draws warning
  1448.  
  1449.    Note that this technique really only works for 255 arguments.  Perhaps
  1450.    this is not enough.  */
  1451.  
  1452. struct candidate
  1453. {
  1454.   tree function;        /* A FUNCTION_DECL */
  1455.  
  1456.   unsigned char evil;        /* ~0 if this will never convert.  */
  1457.   unsigned char user;        /* ~0 if at least one user-defined type conv.  */
  1458.   unsigned short b_or_d;    /* count number of derived->base conv.  */
  1459.   unsigned short easy;        /* count number of builtin type conv.  */
  1460.   tree arg;            /* an _EXPR node that is first parm to function */
  1461.   unsigned short *harshness;    /* Indexed by argument number, encodes
  1462.                    evil, user, b_or_d, and easy strikes for
  1463.                    that argument.
  1464.                    At end of array, we store the index+1 where we
  1465.                    started using default parameters, or 0
  1466.                    if there are none.  */
  1467.   union
  1468.     {
  1469.       tree field;        /* If no evil strikes, the FUNCTION_DECL of
  1470.                    the function (if a member function).  */
  1471.       int bad_arg;        /* the index of the first bad argument:
  1472.                    0 if no bad arguements
  1473.                    > 0 is first bad argument
  1474.                    -1 if extra actual arguments
  1475.                    -2 if too few actual arguments.
  1476.                    -3 if const/non const method mismatch.  */
  1477.     } u;
  1478. };
  1479. int rank_for_overload ();
  1480. struct candidate *ideal_candidate ();
  1481. /* Some macros for char-based bitfields.  */
  1482. #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
  1483. #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
  1484. #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
  1485.  
  1486. /* These are uses as bits in flags passed to build_method_call
  1487.    to control its error reporting behavior.
  1488.  
  1489.    LOOKUP_PROTECT means flag visibility violations.
  1490.    LOOKUP_COMPLAIN mean complain if no suitable member function
  1491.      matching the arguments is found.
  1492.    LOOKUP_NORMAL is just a combination of these two.
  1493.    LOOKUP_AGGR requires the instance to be of aggregate type.
  1494.    LOOKUP_NONVIRTUAL means make a direct call to the member function found
  1495.    LOOKUP_GLOBAL means search through the space of overloaded functions,
  1496.      rather than the space of member functions.
  1497.    LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
  1498.      in the parameter list.
  1499.    LOOKUP_PROTECTED_OK means that even if the constructor we find appears
  1500.      to be non-visibile to current scope, call it anyway.
  1501.    LOOKUP_DYNAMIC means call dynamic functions, a la SOS.
  1502.    LOOKUP_NO_CONVERSION means that user-defined conversions are not
  1503.      permitted.  Built-in conversions are permitted.
  1504.    LOOKUP_DESTRUCTOR means explicit call to destructor.  */
  1505.  
  1506. #define LOOKUP_PROTECT (1)
  1507. #define LOOKUP_COMPLAIN (2)
  1508. #define LOOKUP_NORMAL (3)
  1509. #define LOOKUP_AGGR (4)
  1510. #define LOOKUP_NONVIRTUAL (8)
  1511. #define LOOKUP_GLOBAL (16)
  1512. #define LOOKUP_HAS_IN_CHARGE (32)
  1513. #define LOOKUP_SPECULATIVELY (64)
  1514. #define LOOKUP_PROTECTED_OK (128)
  1515. #define LOOKUP_DYNAMIC (256)
  1516. #define LOOKUP_NO_CONVERSION (512)
  1517. #define LOOKUP_DESTRUCTOR (512)
  1518.  
  1519. /* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
  1520.    purpose = friend name (IDENTIFIER_NODE);
  1521.    value = TREE_LIST of FUNCTION_DECLS;
  1522.    chain, type = EMPTY;  */
  1523. #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
  1524. #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
  1525.  
  1526. extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
  1527. extern tree build_method_call ();
  1528. extern tree build_type_conversion ();
  1529. extern tree build_functional_cast ();
  1530. extern tree build_scoped_method_call ();
  1531. extern tree decl_constant_value ();
  1532.  
  1533. /* in cplus-init.c */
  1534. extern tree resolve_offset_ref ();
  1535. extern tree build_with_cleanup ();
  1536.  
  1537. /* in cplus-lex.c  */
  1538. extern char *operator_name_string ();
  1539.  
  1540. extern tree get_base_type ();
  1541. extern tree build_opid ();
  1542.  
  1543. /* Indexed by TREE_CODE, these tables give C-looking names to
  1544.    operators represented by TREE_CODES.  For example,
  1545.    opname_tab[(int) MINUS_EXPR] == "-".  */
  1546. extern char **opname_tab, **assignop_tab;
  1547.  
  1548. extern tree build_lang_decl (), build_lang_field_decl ();
  1549. extern tree make_lang_type ();
  1550. extern tree cons_up_default_function ();
  1551.  
  1552. /* in cplus-convert.c  */
  1553. extern tree convert_from_reference ();
  1554.  
  1555. /* in cplus-search.c  */
  1556. extern tree init_vbase_pointers ();
  1557. extern tree build_vbase_pointer (), build_vbase_path ();
  1558. extern tree lookup_fnfield (), next_baselink ();
  1559.  
  1560. extern tree get_base_type ();
  1561. extern tree get_vbase_types ();
  1562. extern tree get_baselinks ();
  1563. extern tree get_wrapper ();
  1564. extern tree make_assoc (), copy_assoc ();
  1565. extern tree assoc_value (), virtual_member ();
  1566.  
  1567. #define PRINT_LANG_DECL
  1568. #define PRINT_LANG_TYPE
  1569.  
  1570. #define UNKNOWN_TYPE LANG_TYPE
  1571.  
  1572. extern union tree_node ERROR_MARK_NODE;
  1573.  
  1574. #define error_mark_node (&ERROR_MARK_NODE)
  1575.  
  1576. /* -- end of C++ */
  1577.